package acwing._2LanQiao._1Recursion;

import java.util.Scanner;

/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._1_1Recursion
 * @File : Q0116.java
 * @Author : WangRuoyu
 * @Date : 2023/3/13 14:32
 */
public class Q0116 {

    static void turn_one(char[][] m, int i, int j) {
        m[i][j] = m[i][j] == '+' ? '-' : '+';
    }

    static void turn_all(char[][] m, int i, int j) {
        for (int k = 0; k < m.length; ++k) {
            turn_one(m, i, k);
            turn_one(m, k, j);
        }
        turn_one(m, i, j);
    }

    static boolean check(char[][] m) {
        for (int i = 0; i < m.length; ++i) {
            for (int j = 0; j < m[0].length; ++j) {
                if (m[i][j] != '-') {
                    return false;
                }
            }
        }
        return true;
    }

    static void printed(char[][] m) {
        for (int i = 0; i < m.length; ++i) {
            for (int j = 0; j < m[0].length; ++j) {
                System.out.print(m[i][j] + " ");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        char[][] d = new char[4][4];
        for (int i = 0; i < 4; ++i) {
            String s = scan.nextLine();
            for (int j = 0; j < 4; ++j) {
                d[i][j] = s.charAt(j);
            }
        }

        int[] reses = new int[1 << 16 + 1];
        int count = 0;
        int res = Integer.MAX_VALUE;

        for (int i = 0; i < 1 << 16; ++i) {
            char[][] m = new char[d.length][d[0].length];
            for (int j = 0; j < d.length; ++j) {
                for (int k = 0; k < d[0].length; ++k) {
                    m[j][k] = d[j][k];
                }
            }
            int step = 0;

            for (int j = 0; j < d.length; ++j) {
                for (int k = 0; k < d[0].length; ++k) {
                    if ((i >> (4 * j + k) & 1) == 1) {
                        turn_all(m, j, k);
                        step++;
                    }
                }
            }

            if (check(m)) {
                if (res == step) {
                    reses[count] = i;
                } else if (res > step) {
                    res = step;
                    reses[0] = i;
                    count = 1;
                }
            }

        }

        System.out.println(res);
        for (int i = 0; i < count; ++i) {
            for (int j = 0; j < d.length; ++j) {
                for (int k = 0; k < d[0].length; ++k) {
                    if ((reses[i] >> (4 * j + k) & 1) == 1) {
                        System.out.println(j + 1 + " " + (k + 1));
                    }
                }
            }
        }
    }
}
//-+--
//----
//----
//-+--